using System;

namespace PSSymbolStore
{
    public class Transaction
    {
        public Transaction()
        { }

        public Transaction(TransactionType transactionType)
        {
            _transactionType = transactionType;
        }

        public Transaction(string transactionId, TransactionType transactionType)
        {
            _transactionId = transactionId;
            _transactionType = transactionType;
        }

        private string _transactionId;

        public string TransactionId
        {
            get { return _transactionId; }
            set
            {
                if (_transactionId != value)
                {
                    _transactionId = value;
                    OnTransactionIdChanged(EventArgs.Empty);
                }
            }
        }

        public event EventHandler TransactionIdChanged;

        protected void OnTransactionIdChanged(EventArgs e)
        {
            if (TransactionIdChanged != null)
            {
                TransactionIdChanged(this, e);
            }
        }

        private TransactionType _transactionType;

        public TransactionType TransactionType
        {
            get { return _transactionType; }
            set
            {
                if (_transactionType != value)
                {
                    _transactionType = value;
                    OnTransactionTypeChanged(EventArgs.Empty);
                }
            }
        }

        public event EventHandler TransactionTypeChanged;

        protected void OnTransactionTypeChanged(EventArgs e)
        {
            if (TransactionTypeChanged != null)
            {
                TransactionTypeChanged(this, e);
            }
        }
    }
}
